package com.aoip.telemetry.telemetry.configureui.business.query.monitory.controller;

import com.aoip.telemetry.telemetry.configureui.business.query.monitory.service.MonitoringDataService;
import com.aoip.telemetry.telemetry.configureui.common.core.controller.BaseController;
import com.aoip.telemetry.telemetry.configureui.common.core.page.TableDataInfo;
import com.aoip.telemetry.telemetry.entity.common.OriginalMessageEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 监测数据查询
 *
 * @author chenbai
 * @version 1.0
 * @date 2022/1/7 15:20
 */
@RestController
public class MonitoringDataController extends BaseController {

    @Resource
    private MonitoringDataService service;

    /**
     * 查询原始报文，监测数据分页列表
     * 并加载每条原始报文关联的监测数据信息。
     *
     * @param entity 原始报文信息表实体
     * @return com.aoip.telemetry.telemetry.configureui.common.core.page.TableDataInfo
     * @author chenbai
     * @date 2022/1/10
     **/
    @GetMapping("/v1/GET/monitoring/data/page")
    public TableDataInfo page(OriginalMessageEntity entity) {
        startPage();
        List<OriginalMessageEntity> list = service.list(entity);
        return getDataTable(list);
    }

    @GetMapping("/v1/GET/monitoring/data/detail")
    public TableDataInfo detail(OriginalMessageEntity entity) {
        startPage();
        List<OriginalMessageEntity> list = service.detail(entity);
        return getDataTable(list);
    }
}
